﻿namespace CodeContrib
{
	public class Paging
	{
		private static int _defaultPageSize;
		private int _pageNumber = 1;
		private int _pageSize = DefaultPageSize;

		public static int DefaultPageSize
		{
			get { return _defaultPageSize; }
			private set
			{
				if (value > 0)
				{
					_defaultPageSize = value;
				}
			}
		}

		public int PageNumber
		{
			get { return _pageNumber; }
			private set
			{
				if (value > 0)
				{
					_pageNumber = value;
				}
			}
		}

		public int PageSize
		{
			get { return _pageSize; }
			private set
			{
				if (value > 0)
				{
					_pageSize = value;
				}
			}
		}

		static Paging()
		{
			DefaultPageSize = 10;
		}

		public Paging() : this(1, DefaultPageSize)
		{
		}

		public Paging(int pageNumber) : this(pageNumber, DefaultPageSize)
		{
		}

		public Paging(int pageNumber, int pageSize)
		{
			PageNumber = pageNumber;
			PageSize = pageSize;
		}
	}
}